/*
 * Copyright 2010 Marcin Blazejewski
 *
 * This file is part of Nofate.
 *
 * Nofate is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Nofate is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Nofate. If not, see <http://www.gnu.org/licenses/>.
 *
 */


#ifndef MM_H_
#define MM_H_

#include <redeye.h>
#include <abstract/map.hpp>
#include <abstract/thing.hpp>
#include "dialog.hpp"

#include <vector>
#include <string>

using namespace std;

typedef struct {
    char stay_alive;        // work/stop condition
    int vw;                 // view width
    int vh;                 // view height
    int vox;                // view offset x
    int voy;                // view offset y

    Creature *cre;          // bound creature
    AreaMap *area;          // focused area

    class Dialog *dialog;   // active dialog
} MM;


int             mm_init(int w, int h);
void            mm_end();
void            mm_bind(Creature *cre, AreaMap *area);
int             mm_tick();
void            mm_message(const char *txt, char is_temp);



class Textbox {
public:
    int     left;
    int     top;
    int     width;          // in characters
    int     height;         // in lines
    int     fg;
    int     bg;
    int     cursor_x;
    int     cursor_y;
    int     offset;
    vector<string> lines;
    int     solid_lines;

    Textbox(int left, int top, int w, int h);
    ~Textbox();

    void            puts_xy(const char *txt, int x, int y);
    void            puts(const char *txt);
    void            goto_xy(int x, int y);
    void            newline();
    void            scroll(int dy);
    void            draw();
    void            message(const char *txt, char is_temp);

    
};


#endif
